﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wwtfly.BBS.BackModels.Models.Users;
using Wwtfly.Utility;
using Wwtfly.BBS.BackModels.Models.Right;
using Wwtfly.BBS.BackBLL.Right;
using Wwtfly.BBS.BackBLL.Plays;
using Wwtfly.BBS.BackModels.Models.PlaysType;
using System.Data;

namespace Wwtfly.BBS.ForeApplication.WebForm.users
{
    public partial class ExpertNewAdd : System.Web.UI.Page
    {
        protected static UsersModel usermd = null;
        protected static UAUserOfRoleModel userRole = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
             
                       this.DropDownListLotteryType.DataSource = PlaysTypesBLL.GetPlaysTypesList();
                       this.DropDownListLotteryType.DataTextField="LotteryName";
                       this.DropDownListLotteryType.DataValueField = "LotteryID";
                       this.DropDownListLotteryType.DataBind();

                       PlayNoList(6);
                //if (Session[LoginUserUtil.LOGIN_USER] != null)
                //{
                //    usermd = Session[LoginUserUtil.LOGIN_USER] as UsersModel;
                //    userRole = UAUserOfRoleBLL.GetInfo(usermd.Id);
                //    if (userRole != null)
                //    {
                //        if (userRole.RoleID != 5)
                //        {
                //            Response.Write("<script> alert('非法操作，且不是专家用户!');</script>");
                //            return;
                //        }
                //        else
                //        {
                //            this.DropDownListLotteryType.DataSource = PlaysTypesBLL.GetPlaysTypesList();
                //            this.DropDownListLotteryType.DataTextField = "LotteryName";
                //            this.DropDownListLotteryType.DataValueField = "LotteryID";
                //        }
                //    }
                //}
            }
        }
        /// <summary>
        /// 根据彩种ID改变彩种期号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DropDownListLotteryType_SelectedIndexChanged(object sender, EventArgs e)
        {
            int lotterid =Convert.ToInt32(this.DropDownListLotteryType.SelectedValue);
            PlayNoList(lotterid);
        }

        private void PlayNoList(int lotterid)
        {
            this.DropDownListLotteryNo.DataSource = PlaysBLL.GetPlayShowList(lotterid);
            this.DropDownListLotteryNo.DataTextField = "PlayNo";
            this.DropDownListLotteryNo.DataValueField = "LotteryID";
            this.DropDownListLotteryNo.DataBind();
        }

    }
}